﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Valve.VR
{
	// Token: 0x02000784 RID: 1924
	public class CVRSystem
	{
		// Token: 0x06002DDD RID: 11741 RVA: 0x000F14DC File Offset: 0x000EF6DC
		internal CVRSystem(IntPtr pInterface)
		{
			this.FnTable = (IVRSystem)Marshal.PtrToStructure(pInterface, typeof(IVRSystem));
		}

		// Token: 0x06002DDE RID: 11742 RVA: 0x000F1500 File Offset: 0x000EF700
		public void GetRecommendedRenderTargetSize(ref uint pnWidth, ref uint pnHeight)
		{
			pnWidth = 0U;
			pnHeight = 0U;
			this.FnTable.GetRecommendedRenderTargetSize(ref pnWidth, ref pnHeight);
		}

		// Token: 0x06002DDF RID: 11743 RVA: 0x000F151C File Offset: 0x000EF71C
		public HmdMatrix44_t GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ)
		{
			return this.FnTable.GetProjectionMatrix(eEye, fNearZ, fFarZ);
		}

		// Token: 0x06002DE0 RID: 11744 RVA: 0x000F1540 File Offset: 0x000EF740
		public void GetProjectionRaw(EVREye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom)
		{
			pfLeft = 0f;
			pfRight = 0f;
			pfTop = 0f;
			pfBottom = 0f;
			this.FnTable.GetProjectionRaw(eEye, ref pfLeft, ref pfRight, ref pfTop, ref pfBottom);
		}

		// Token: 0x06002DE1 RID: 11745 RVA: 0x000F1578 File Offset: 0x000EF778
		public bool ComputeDistortion(EVREye eEye, float fU, float fV, ref DistortionCoordinates_t pDistortionCoordinates)
		{
			return this.FnTable.ComputeDistortion(eEye, fU, fV, ref pDistortionCoordinates);
		}

		// Token: 0x06002DE2 RID: 11746 RVA: 0x000F159C File Offset: 0x000EF79C
		public HmdMatrix34_t GetEyeToHeadTransform(EVREye eEye)
		{
			return this.FnTable.GetEyeToHeadTransform(eEye);
		}

		// Token: 0x06002DE3 RID: 11747 RVA: 0x000F15BC File Offset: 0x000EF7BC
		public bool GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync, ref ulong pulFrameCounter)
		{
			pfSecondsSinceLastVsync = 0f;
			pulFrameCounter = 0UL;
			return this.FnTable.GetTimeSinceLastVsync(ref pfSecondsSinceLastVsync, ref pulFrameCounter);
		}

		// Token: 0x06002DE4 RID: 11748 RVA: 0x000F15E8 File Offset: 0x000EF7E8
		public int GetD3D9AdapterIndex()
		{
			return this.FnTable.GetD3D9AdapterIndex();
		}

		// Token: 0x06002DE5 RID: 11749 RVA: 0x000F1608 File Offset: 0x000EF808
		public void GetDXGIOutputInfo(ref int pnAdapterIndex)
		{
			pnAdapterIndex = 0;
			this.FnTable.GetDXGIOutputInfo(ref pnAdapterIndex);
		}

		// Token: 0x06002DE6 RID: 11750 RVA: 0x000F1620 File Offset: 0x000EF820
		public void GetOutputDevice(ref ulong pnDevice, ETextureType textureType)
		{
			pnDevice = 0UL;
			this.FnTable.GetOutputDevice(ref pnDevice, textureType);
		}

		// Token: 0x06002DE7 RID: 11751 RVA: 0x000F1638 File Offset: 0x000EF838
		public bool IsDisplayOnDesktop()
		{
			return this.FnTable.IsDisplayOnDesktop();
		}

		// Token: 0x06002DE8 RID: 11752 RVA: 0x000F1658 File Offset: 0x000EF858
		public bool SetDisplayVisibility(bool bIsVisibleOnDesktop)
		{
			return this.FnTable.SetDisplayVisibility(bIsVisibleOnDesktop);
		}

		// Token: 0x06002DE9 RID: 11753 RVA: 0x000F1678 File Offset: 0x000EF878
		public void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, TrackedDevicePose_t[] pTrackedDevicePoseArray)
		{
			this.FnTable.GetDeviceToAbsoluteTrackingPose(eOrigin, fPredictedSecondsToPhotonsFromNow, pTrackedDevicePoseArray, (uint)pTrackedDevicePoseArray.Length);
		}

		// Token: 0x06002DEA RID: 11754 RVA: 0x000F1690 File Offset: 0x000EF890
		public void ResetSeatedZeroPose()
		{
			this.FnTable.ResetSeatedZeroPose();
		}

		// Token: 0x06002DEB RID: 11755 RVA: 0x000F16A4 File Offset: 0x000EF8A4
		public HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose()
		{
			return this.FnTable.GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
		}

		// Token: 0x06002DEC RID: 11756 RVA: 0x000F16C4 File Offset: 0x000EF8C4
		public HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose()
		{
			return this.FnTable.GetRawZeroPoseToStandingAbsoluteTrackingPose();
		}

		// Token: 0x06002DED RID: 11757 RVA: 0x000F16E4 File Offset: 0x000EF8E4
		public uint GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass, uint[] punTrackedDeviceIndexArray, uint unRelativeToTrackedDeviceIndex)
		{
			return this.FnTable.GetSortedTrackedDeviceIndicesOfClass(eTrackedDeviceClass, punTrackedDeviceIndexArray, (uint)punTrackedDeviceIndexArray.Length, unRelativeToTrackedDeviceIndex);
		}

		// Token: 0x06002DEE RID: 11758 RVA: 0x000F170C File Offset: 0x000EF90C
		public EDeviceActivityLevel GetTrackedDeviceActivityLevel(uint unDeviceId)
		{
			return this.FnTable.GetTrackedDeviceActivityLevel(unDeviceId);
		}

		// Token: 0x06002DEF RID: 11759 RVA: 0x000F172C File Offset: 0x000EF92C
		public void ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform)
		{
			this.FnTable.ApplyTransform(ref pOutputPose, ref pTrackedDevicePose, ref pTransform);
		}

		// Token: 0x06002DF0 RID: 11760 RVA: 0x000F1744 File Offset: 0x000EF944
		public uint GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType)
		{
			return this.FnTable.GetTrackedDeviceIndexForControllerRole(unDeviceType);
		}

		// Token: 0x06002DF1 RID: 11761 RVA: 0x000F1764 File Offset: 0x000EF964
		public ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex)
		{
			return this.FnTable.GetControllerRoleForTrackedDeviceIndex(unDeviceIndex);
		}

		// Token: 0x06002DF2 RID: 11762 RVA: 0x000F1784 File Offset: 0x000EF984
		public ETrackedDeviceClass GetTrackedDeviceClass(uint unDeviceIndex)
		{
			return this.FnTable.GetTrackedDeviceClass(unDeviceIndex);
		}

		// Token: 0x06002DF3 RID: 11763 RVA: 0x000F17A4 File Offset: 0x000EF9A4
		public bool IsTrackedDeviceConnected(uint unDeviceIndex)
		{
			return this.FnTable.IsTrackedDeviceConnected(unDeviceIndex);
		}

		// Token: 0x06002DF4 RID: 11764 RVA: 0x000F17C4 File Offset: 0x000EF9C4
		public bool GetBoolTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetBoolTrackedDeviceProperty(unDeviceIndex, prop, ref pError);
		}

		// Token: 0x06002DF5 RID: 11765 RVA: 0x000F17E8 File Offset: 0x000EF9E8
		public float GetFloatTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetFloatTrackedDeviceProperty(unDeviceIndex, prop, ref pError);
		}

		// Token: 0x06002DF6 RID: 11766 RVA: 0x000F180C File Offset: 0x000EFA0C
		public int GetInt32TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetInt32TrackedDeviceProperty(unDeviceIndex, prop, ref pError);
		}

		// Token: 0x06002DF7 RID: 11767 RVA: 0x000F1830 File Offset: 0x000EFA30
		public ulong GetUint64TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetUint64TrackedDeviceProperty(unDeviceIndex, prop, ref pError);
		}

		// Token: 0x06002DF8 RID: 11768 RVA: 0x000F1854 File Offset: 0x000EFA54
		public HmdMatrix34_t GetMatrix34TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetMatrix34TrackedDeviceProperty(unDeviceIndex, prop, ref pError);
		}

		// Token: 0x06002DF9 RID: 11769 RVA: 0x000F1878 File Offset: 0x000EFA78
		public uint GetStringTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, StringBuilder pchValue, uint unBufferSize, ref ETrackedPropertyError pError)
		{
			return this.FnTable.GetStringTrackedDeviceProperty(unDeviceIndex, prop, pchValue, unBufferSize, ref pError);
		}

		// Token: 0x06002DFA RID: 11770 RVA: 0x000F18A0 File Offset: 0x000EFAA0
		public string GetPropErrorNameFromEnum(ETrackedPropertyError error)
		{
			IntPtr ptr = this.FnTable.GetPropErrorNameFromEnum(error);
			return Marshal.PtrToStringAnsi(ptr);
		}

		// Token: 0x06002DFB RID: 11771 RVA: 0x000F18C8 File Offset: 0x000EFAC8
		public bool PollNextEvent(ref VREvent_t pEvent, uint uncbVREvent)
		{
			if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
			{
				VREvent_t_Packed vrevent_t_Packed = default(VREvent_t_Packed);
				CVRSystem.PollNextEventUnion pollNextEventUnion;
				pollNextEventUnion.pPollNextEventPacked = null;
				pollNextEventUnion.pPollNextEvent = this.FnTable.PollNextEvent;
				bool result = pollNextEventUnion.pPollNextEventPacked(ref vrevent_t_Packed, (uint)Marshal.SizeOf(typeof(VREvent_t_Packed)));
				vrevent_t_Packed.Unpack(ref pEvent);
				return result;
			}
			return this.FnTable.PollNextEvent(ref pEvent, uncbVREvent);
		}

		// Token: 0x06002DFC RID: 11772 RVA: 0x000F1954 File Offset: 0x000EFB54
		public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose)
		{
			return this.FnTable.PollNextEventWithPose(eOrigin, ref pEvent, uncbVREvent, ref pTrackedDevicePose);
		}

		// Token: 0x06002DFD RID: 11773 RVA: 0x000F1978 File Offset: 0x000EFB78
		public string GetEventTypeNameFromEnum(EVREventType eType)
		{
			IntPtr ptr = this.FnTable.GetEventTypeNameFromEnum(eType);
			return Marshal.PtrToStringAnsi(ptr);
		}

		// Token: 0x06002DFE RID: 11774 RVA: 0x000F19A0 File Offset: 0x000EFBA0
		public HiddenAreaMesh_t GetHiddenAreaMesh(EVREye eEye, EHiddenAreaMeshType type)
		{
			return this.FnTable.GetHiddenAreaMesh(eEye, type);
		}

		// Token: 0x06002DFF RID: 11775 RVA: 0x000F19C4 File Offset: 0x000EFBC4
		public bool GetControllerState(uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize)
		{
			if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
			{
				VRControllerState_t_Packed vrcontrollerState_t_Packed = new VRControllerState_t_Packed(pControllerState);
				CVRSystem.GetControllerStateUnion getControllerStateUnion;
				getControllerStateUnion.pGetControllerStatePacked = null;
				getControllerStateUnion.pGetControllerState = this.FnTable.GetControllerState;
				bool result = getControllerStateUnion.pGetControllerStatePacked(unControllerDeviceIndex, ref vrcontrollerState_t_Packed, (uint)Marshal.SizeOf(typeof(VRControllerState_t_Packed)));
				vrcontrollerState_t_Packed.Unpack(ref pControllerState);
				return result;
			}
			return this.FnTable.GetControllerState(unControllerDeviceIndex, ref pControllerState, unControllerStateSize);
		}

		// Token: 0x06002E00 RID: 11776 RVA: 0x000F1A58 File Offset: 0x000EFC58
		public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose)
		{
			if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
			{
				VRControllerState_t_Packed vrcontrollerState_t_Packed = new VRControllerState_t_Packed(pControllerState);
				CVRSystem.GetControllerStateWithPoseUnion getControllerStateWithPoseUnion;
				getControllerStateWithPoseUnion.pGetControllerStateWithPosePacked = null;
				getControllerStateWithPoseUnion.pGetControllerStateWithPose = this.FnTable.GetControllerStateWithPose;
				bool result = getControllerStateWithPoseUnion.pGetControllerStateWithPosePacked(eOrigin, unControllerDeviceIndex, ref vrcontrollerState_t_Packed, (uint)Marshal.SizeOf(typeof(VRControllerState_t_Packed)), ref pTrackedDevicePose);
				vrcontrollerState_t_Packed.Unpack(ref pControllerState);
				return result;
			}
			return this.FnTable.GetControllerStateWithPose(eOrigin, unControllerDeviceIndex, ref pControllerState, unControllerStateSize, ref pTrackedDevicePose);
		}

		// Token: 0x06002E01 RID: 11777 RVA: 0x000F1AF4 File Offset: 0x000EFCF4
		public void TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, char usDurationMicroSec)
		{
			this.FnTable.TriggerHapticPulse(unControllerDeviceIndex, unAxisId, usDurationMicroSec);
		}

		// Token: 0x06002E02 RID: 11778 RVA: 0x000F1B0C File Offset: 0x000EFD0C
		public string GetButtonIdNameFromEnum(EVRButtonId eButtonId)
		{
			IntPtr ptr = this.FnTable.GetButtonIdNameFromEnum(eButtonId);
			return Marshal.PtrToStringAnsi(ptr);
		}

		// Token: 0x06002E03 RID: 11779 RVA: 0x000F1B34 File Offset: 0x000EFD34
		public string GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType)
		{
			IntPtr ptr = this.FnTable.GetControllerAxisTypeNameFromEnum(eAxisType);
			return Marshal.PtrToStringAnsi(ptr);
		}

		// Token: 0x06002E04 RID: 11780 RVA: 0x000F1B5C File Offset: 0x000EFD5C
		public bool CaptureInputFocus()
		{
			return this.FnTable.CaptureInputFocus();
		}

		// Token: 0x06002E05 RID: 11781 RVA: 0x000F1B7C File Offset: 0x000EFD7C
		public void ReleaseInputFocus()
		{
			this.FnTable.ReleaseInputFocus();
		}

		// Token: 0x06002E06 RID: 11782 RVA: 0x000F1B90 File Offset: 0x000EFD90
		public bool IsInputFocusCapturedByAnotherProcess()
		{
			return this.FnTable.IsInputFocusCapturedByAnotherProcess();
		}

		// Token: 0x06002E07 RID: 11783 RVA: 0x000F1BB0 File Offset: 0x000EFDB0
		public uint DriverDebugRequest(uint unDeviceIndex, string pchRequest, string pchResponseBuffer, uint unResponseBufferSize)
		{
			return this.FnTable.DriverDebugRequest(unDeviceIndex, pchRequest, pchResponseBuffer, unResponseBufferSize);
		}

		// Token: 0x06002E08 RID: 11784 RVA: 0x000F1BD4 File Offset: 0x000EFDD4
		public EVRFirmwareError PerformFirmwareUpdate(uint unDeviceIndex)
		{
			return this.FnTable.PerformFirmwareUpdate(unDeviceIndex);
		}

		// Token: 0x06002E09 RID: 11785 RVA: 0x000F1BF4 File Offset: 0x000EFDF4
		public void AcknowledgeQuit_Exiting()
		{
			this.FnTable.AcknowledgeQuit_Exiting();
		}

		// Token: 0x06002E0A RID: 11786 RVA: 0x000F1C08 File Offset: 0x000EFE08
		public void AcknowledgeQuit_UserPrompt()
		{
			this.FnTable.AcknowledgeQuit_UserPrompt();
		}

		// Token: 0x04002AD4 RID: 10964
		private IVRSystem FnTable;

		// Token: 0x02000785 RID: 1925
		// (Invoke) Token: 0x06002E0C RID: 11788
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _PollNextEventPacked(ref VREvent_t_Packed pEvent, uint uncbVREvent);

		// Token: 0x02000786 RID: 1926
		[StructLayout(LayoutKind.Explicit)]
		private struct PollNextEventUnion
		{
			// Token: 0x04002AD5 RID: 10965
			[FieldOffset(0)]
			public IVRSystem._PollNextEvent pPollNextEvent;

			// Token: 0x04002AD6 RID: 10966
			[FieldOffset(0)]
			public CVRSystem._PollNextEventPacked pPollNextEventPacked;
		}

		// Token: 0x02000787 RID: 1927
		// (Invoke) Token: 0x06002E10 RID: 11792
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetControllerStatePacked(uint unControllerDeviceIndex, ref VRControllerState_t_Packed pControllerState, uint unControllerStateSize);

		// Token: 0x02000788 RID: 1928
		[StructLayout(LayoutKind.Explicit)]
		private struct GetControllerStateUnion
		{
			// Token: 0x04002AD7 RID: 10967
			[FieldOffset(0)]
			public IVRSystem._GetControllerState pGetControllerState;

			// Token: 0x04002AD8 RID: 10968
			[FieldOffset(0)]
			public CVRSystem._GetControllerStatePacked pGetControllerStatePacked;
		}

		// Token: 0x02000789 RID: 1929
		// (Invoke) Token: 0x06002E14 RID: 11796
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetControllerStateWithPosePacked(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t_Packed pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose);

		// Token: 0x0200078A RID: 1930
		[StructLayout(LayoutKind.Explicit)]
		private struct GetControllerStateWithPoseUnion
		{
			// Token: 0x04002AD9 RID: 10969
			[FieldOffset(0)]
			public IVRSystem._GetControllerStateWithPose pGetControllerStateWithPose;

			// Token: 0x04002ADA RID: 10970
			[FieldOffset(0)]
			public CVRSystem._GetControllerStateWithPosePacked pGetControllerStateWithPosePacked;
		}
	}
}
